<!-- 创意推广类型输入表 -->
<template>
  <div class="mainTable">
    <BaseTable :query="query" :importName="importName" :importURL="importURL" :tableItems="tableItems"
      :updateItems="updateItems" :optionList="optionList" :methodParam="methodParam" :commitUrl="commitParam" :imgUrlPrefix="imgUrlPrefix" :Btn="Btn" menuName="logRecord"
      pageName="mainTable" @change-creativityPromotionChannel="changeCreativityPromotionChannel"/>
  </div>
</template>
<script>
import dayjs from "dayjs"
import BaseTable from "@/components/table/importTable.vue";
import { service } from "../../../services/backServices";
export default {
  name: "cytglxsrb",
  data() {
    return {
      //后端人员修改-S
      //查询参数
      query: [
      { prop: "creativityPromotionChannel", type: "select", placeholder: "", value: "品销宝", name: "渠道名称" },
      ],
      //表格表头
      tableItems: [
        { name: "数据输入时间", prop: "上传该条数据记录的时间", align: "left" },
        { name: "创意推广渠道", prop: "创意推广渠道", align: "left" },
        { name: "创意ID", prop: "创意ID", align: "left" },
        { name: "创意图片", prop: "创意图片", align: "left", type: "img" },
        { name: "创意图片链接", prop: "创意图片链接", align: "left" },
        { name: "创意类型", prop: "创意类型", align: "left", type: "select" },
      ],
      //增删查改的对象属性
      updateItems: [//edit是回复
        { name: "文件名称", prop: "fileName", type: "input", disabled: true },
        { name: "上传类型", prop: "uploadType", type: "select" },
        { name: "备注", prop: "remark", type: "textarea" },
        { name: "上传文件", prop: "fileAdd", type: "upload" },
      ],
      //增删查改的对象属性的下拉select或者级联cascader
      optionList: {
        creativityPromotionChannel: [
          {label: "万相台", value: "万相台" },
          {label: "品销宝", value: "品销宝" },
        ],
        "创意类型": []
      },
      //增删查改方法参数
      methodParam: "getCreativityPromotionCreativityKindInput",
      commitParam: 'commitCreativityPromotionCreativityKind',
      imgUrlPrefix: GlobalSetting.imgUrlPrefix,
      //自定义btn功能
      Btn: {
        search: true, //查询按钮
        add: false, //添加按钮
        edit: false, //回复按钮
        detail: false, //详情按钮
        delete: false, //删除按钮
        deletes: false, //批量删除按钮
        export: true, //导出按钮
        templateDownload: false, //模板下载按钮
        upload: false, //上传按钮
        commit: true,
      },
      //后端人员修改-E
      importName: "创意推广类型输入表",
      importURL: "uploadCreativityPromotionCreativityKindInput"
    };
  },
  components: {
    BaseTable
  },
  methods: {
    // 获取创意类型list
    getCreativityKindList(val){
      service({
        url: 'getAllCreativityKind',
        method: "post",
        data: {
          channel: val
        }
      }).then(res => {
        if(res.data.code == 200) {
          this.optionList["创意类型"] = res.data.data.map(x => {
            return {
              value: x,
              label: x
            }
          })
        }
      })
    },
    changeCreativityPromotionChannel(val) {
      this.getCreativityKindList(val)
    },

  },
  created() {
    this.getCreativityKindList(this.query[0].value)
  }
};
</script>
<style scoped lang="less">
.mainTable {
  background-color: #f1f2f9;
}
</style>
  